﻿using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Graphics;
using Syngine.Content;

namespace Syngine
{
	/// <summary>
	/// 
	/// </summary>
	public static class AssetExtensions
	{
		/// <summary>
		/// Returns the bounds of the specified asset.
		/// </summary>
		/// <param name="asset">The asset.</param>
		/// <returns></returns>
		public static Rectangle Bounds(this Asset<Texture2D> asset)
		{
			return asset.Resource.Bounds;
		}

		/// <summary>
		/// Returns the width of the specified asset.
		/// </summary>
		/// <param name="asset">The asset.</param>
		/// <returns></returns>
		public static int Width(this Asset<Texture2D> asset)
		{
			return asset.Resource.Width;
		}

		/// <summary>
		/// Returns the height of the specified asset.
		/// </summary>
		/// <param name="asset">The asset.</param>
		/// <returns></returns>
		public static int Height(this Asset<Texture2D> asset)
		{
			return asset.Resource.Height;
		}

		/// <summary>
		/// Gets the data for the current texture.
		/// </summary>
		/// <param name="asset">The asset.</param>
		/// <param name="data"></param>
		/// <returns></returns>
		public static void GetData<T>(this Asset<Texture2D> asset, T[] data) where T : struct
		{
			asset.Resource.GetData(data);
		}
	}
}
